home *** CD-ROM | disk | FTP | other *** search
/ Languguage OS 2 / Languguage OS II Version 10-94 (Knowledge Media)(1994).ISO / language / embedded / m68k / vubug.arc / VUBug.arc / VUBug.doc next >
Text File  |  1989-11-13  |  16KB  |  354 lines

  1.  
  2.                           VUBug:  AN M68000 MONITOR PROGRAM            
  3.  
  4.           I.  Introduction.
  5.           
  6.                VUBug is a primitive single user monitor program designed 
  7.           to interface the user to the "Raymatic" M68000 development board 
  8.           designed by Raymond Carr at Vanderbilt University in 1988.  The
  9.           monitor program itself was originally written by Edward M. Carter
  10.           also while at Vanderbilt in 1983.  This documentation relates to
  11.           the 1988 version of the program, about two thirds of which is new.
  12.           The new stuff was added by Russell G. Brown, then of Vanderbilt, but
  13.           lately of Cornell Computer Science.  It allows the user to perform
  14.           such operations as are necessary to develop and debug M68000
  15.           assembly programs in conjunction with a host computer running 
  16.           an M68000 assembler which is capable of generating object code in
  17.           the Motorola S-record format.  Some functions provided by VUBUG 
  18.           are load from host, dump memory, disassemble memory, and run at 
  19.           address.  Feel free to distribute this source and documentation,
  20.           but make sure that the copyright and like information stays on it.
  21.           Also, please make sure that any modified version of this program
  22.           which you may distribute is obviously marked as being modified.
  23.           
  24.  
  25.           II.  Running VUBug
  26.           
  27.                VUbug comes up running as soon as power is applied to the 
  28.           system.  It asserts its presence by printing the following 
  29.           message:
  30.           
  31.                M68000 Monitor VUBug Version 4.0 27 April, 1988
  32.           
  33.           
  34.                !_
  35.           
  36.           If there is anything wrong with the system RAM, it will instead 
  37.           respond
  38.           
  39.                RAM Error!!!!
  40.           
  41.           Assuming that a RAM error doesn't happen, you can now begin 
  42.           entering commands.
  43.           
  44.  
  45.           III.  Getting Started
  46.           
  47.                The first thing that you will want to do is to load and 
  48.           execute an assembly language program using VUBug.  The following 
  49.           is an example interactive execution session:
  50.           
  51.           1.   Turn on the system.  The VUBug boot message prints at the 
  52.                terminal.
  53.           2.   Type 'e'.  VUBug responds "Terminal Mode:".
  54.           3.   Log into the host system.  Enter vi and type in the
  55.                following program:
  56.  
  57.                         org     $4400
  58.                         move.l  #$00000004,d0
  59.                         movea.l #$000019ca,a3
  60.                         adda.w  d0,a3
  61.                         move.l  a3,d0
  62.                         trap    #$06
  63.                         trap    #$0
  64.                         end 
  65.  
  66.                     4.   Write and quit from vi.  Assemble the program by 
  67.           typing 
  68.  
  69.                         mas68k -l <progname>.
  70.  
  71.                where progname is the name of your sample program. 5.   
  72.           Examine the listing file produced by mas68k to see the source 
  73.                and object code together.  The listing file is called
  74.                <progname.l>.
  75.           6.   Type 'cat <progname.o>' but DO NOT! type a carriage return.
  76.           7.   type ctrl-L.  VUBug will exit terminal mode, feed a
  77.                carriage return to the host, and accept an Srec format object
  78.                file.
  79.           8.   You are now back in VUBug.  Type 'a 4400'.  You will see an
  80.                assembly listing which is equivalent to your source code,
  81.                except that it has values substituted for all labels.  There
  82.                will be a number of garbage lines following the program.
  83.                disregard these.
  84.           9.   Type 'g 4400'.  This is the command meaning "go at $4400".
  85.                VUBug responds with the following:
  86.  
  87.                         Program:
  88.  
  89.                         000019ce
  90.                         !
  91.  
  92.                This is approximately how all debugging sessions should
  93.           begin.  Once you have become more familiar with VUBug, you will
  94.           learn shortcuts and enhancements, but the commands already used
  95.           will serve for a start.
  96.  
  97.  
  98.           IV.  VUBug Commands
  99.  
  100.                This section contains the full, alphabetic listing of the 
  101.           commands provided in VUBug.  For information on how to get help 
  102.           for commands while in VUBug, see the section on 'h'. 
  103.           
  104.            
  105.  
  106.                A - Assembly Listing
  107.                
  108.                A provides a source code listing of memory locations 
  109.                specified in one of the following ways:
  110.                
  111.                         A<cr>           List 20 instructions from last 
  112.                                         examined address. 
  113.                         A xxxx          List 20 instructions from address 
  114.                                         xxxx. 
  115.                         A xxxx,yyyy     List from xxxx to yyyy.
  116.  
  117.                B - Set/Remove Breakpoints 
  118.                
  119.                B permits the setting and removing of breakpoints in a user 
  120.                program.  B is invoked as follows:
  121.                
  122.                         B<cr>           List all breakpoints.
  123.                         B+xxxx          Add a breakpoint at address xxxx. 
  124.                         B-xxxx          Remove a breakpoint at xxxx. 
  125.                         B#              Remove all breakpoints.
  126.                
  127.                
  128.                
  129.                C - Copy Memory 
  130.                
  131.                C allows the copying of a data block from one location to 
  132.                another.  It is called using:
  133.                
  134.                         C xxxx=yyyy,zzzz.
  135.                
  136.                This copies memory from a block which starts at yyyy and 
  137.                ends at zzzz to a block starting at xxxx.  NOTE:  the copy 
  138.                routine works from bottom to top.  Therefore care must be 
  139.                taken when copying between blocks that share address space.
  140.                
  141.                
  142.                
  143.                D - Dump Memory 
  144.  
  145.                D is used to provide a hex dump of memory.  Memory is 
  146.                printed out in lines consisting of an address, 16 hex 
  147.                values, and the ascii representation of such of those 
  148.                values as have printable characters.  The format for 
  149.                calling D is as follows: 
  150.                
  151.                         D<cr>           Dump 64 bytes from last examined 
  152.                                         location.
  153.                         D xxxx          Dump 64 bytes from xxxx.
  154.                         D xxxx,yyyy     Dump bytes from xxxx to yyyy.
  155.                
  156.                
  157.                
  158.                E - Enter terminal emulator mode
  159.                
  160.                When E is entered, VUBug enters a passthrough mode in which 
  161.                any key entered at the keyboard is passed through to the 
  162.                host, and vice versa.  This is true for all characters 
  163.                except for ctrl-X, which causes VUBug to exit terminal 
  164.                emulator mode, and ctrl-L, which is the same as ctrl-X, 
  165.                except that it causes VUBug to enter load mode.  E is 
  166.                invoked as follows:
  167.                
  168.                         E<cr>
  169.  
  170.                G - Start user program
  171.                
  172.                G is the VUBug command to start a user program running.  A 
  173.                user program which is properly designed to end will have as 
  174.                its last executed line
  175.                
  176.                         trap    #$00 
  177.                
  178.                G is called in one of the following ways:
  179.                
  180.                         G<cr>           Go from start address in the last 
  181.                                         executed L command.
  182.                         <cr>            Same as G<cr>. 
  183.                         G xxxx          Go from address xxxx.
  184.                
  185.                
  186.                
  187.                H - Print help messages.
  188.                
  189.                H is used to print a simple message (consisting mostly of 
  190.                instruction syntax) to the terminal.  It is called with:
  191.                
  192.                         H<cr>           Prints a list of commands for 
  193.                                         which help is available. 
  194.                         Hx              Prints the long help message for
  195.                                         command x.  If x is nonexistant,
  196.                                         Hx acts like H<cr>.
  197.                
  198.                
  199.                
  200.                L - Load user program from host
  201.                
  202.                L causes VUBug to accept an S-record format object file 
  203.                from the host.  It is called in one of the following ways:
  204.                
  205.                         L<cr>           Load from host with no offset.
  206.                         ctrl-L          Same as L<cr> but invoked from 
  207.                                         emulator mode.
  208.                         L xxxx          Load from host with offset xxxx.
  209.  
  210.                M - Enter memory update mode
  211.                
  212.                M invokes a submode of VUBug in which modifications to 
  213.                memory locations can be made.  M is invoked as follows:
  214.                
  215.                         M<cr>           Start memory mode. 
  216.                         M xxxx          Start memory mode at xxxx. 
  217.  
  218.                Memory mode subcommands are the following:
  219.                
  220.                         .xxxx           Set pointer to location xxxx.
  221.                         =xx             Update current location to xx.
  222.                         ,xx             Increment pointer, then update.
  223.                         +               Increment pointer.
  224.                         -               Decrement pointer
  225.                         <cr>            Print current pointer and value.
  226.                
  227.                Typing any other character in memory update mode causes an 
  228.                exit back into VUBug proper.
  229.                
  230.                
  231.                
  232.                P - Prototype commands in RAM
  233.                
  234.                P allows the user to create new command subroutines in RAM 
  235.                and call them without having to burn new ROMs.  This is 
  236.                significant in that ordinarily user programs cannot make 
  237.                use of the interrupt routines and other subroutines 
  238.                provided in VUBug.  P is set up to allow a user routine to 
  239.                make use of these subroutines.  It is invoked as follows:
  240.                
  241.                         Px xxxx         Load address xxxx for prototype 
  242.                                         command x.
  243.                         Px<cr>          Execute prototype command x.
  244.                
  245.                Note that x must be a 1, 2, or 3.
  246.  
  247.                R - Enter register examine/update mode
  248.                
  249.                R invokes a submode of VUBug in which registers may be 
  250.                examined and changed.  It is called in the following way:
  251.                
  252.                         R<cr>           Start register mode.
  253.                         R xx            Start mode at register xx, 
  254.                                         where xx is one of:
  255.                                                 SR/_sr - status register, 
  256.                                                 PC/_pc - program counter, 
  257.                                                 dx - data register 0 - 7, 
  258.                                                 ax - address reg. 0 - 7.
  259.                
  260.                Register examine/update commands are as follows:
  261.                
  262.                         .xx             Set pointer to register xx. 
  263.                         =xxxxxxxx       Set current register to xxxxxxxx. 
  264.                         <cr>            Print all registers.
  265.                
  266.                Any other character entered in register submode causes an 
  267.                exit to VUBug.
  268.                
  269.                
  270.                
  271.                S - Single step mode
  272.                
  273.                In single step mode, a Go command causes VUBug to execute a 
  274.                single instruction and then return to the prompt, allowing 
  275.                registers to be examined and changed between instructions. 
  276.                S is called in one of two ways:
  277.                
  278.                         S+              Turn on single step mode. 
  279.                         S-              Turn off single step mode.
  280.                
  281.                
  282.                
  283.                T - Trace mode
  284.                
  285.                In trace mode, a Go command causes VUBug to execute a 
  286.                program, printing out the PC after each instruction.  This 
  287.                permits tracing of a program's path.  It is called as 
  288.                follows:
  289.                
  290.                         T+              Turn on trace mode.
  291.                         T-              Turn off trace mode. V.   
  292.  
  293.                U - Upload user program from terminal
  294.  
  295.                U allows VUBug to upload an S-record format object file
  296.                from the terminal.  This allows the user to connect the
  297.                68000 board to a microcomputer, using it as both terminal
  298.                and host.  Upload is invoked with one of the following
  299.                commands:
  300.  
  301.                         U<cr>           Upload from terminal with no offset.
  302.                         U xxxx          Upload from terminal with offset xxxx.
  303.  
  304.  
  305.           V.   Troubleshooting 
  306.           
  307.                There is not a whole lot that can go wrong with VUBug.  
  308.           Most of the possible difficulties actually have their roots in 
  309.           hardware.  If a RAM error is indicated at boot-up time, then one 
  310.           of the system RAM chips needs replacing.  If no boot-up message 
  311.           is printed, then something is wrong with one of the following:  
  312.           the terminal, the terminal cable, the ACIAs on the development 
  313.           board, the system RAM, or the VUBug ROM.
  314.           
  315.                If an error is found in VUBug's performance, the thing to 
  316.           do is to document carefully when and where the bug appears, and 
  317.           report the problem to the nearest digital electronics professor.
  318.           
  319.           
  320.           VI.  Caveats
  321.  
  322.                A number of things should be taken into account when using
  323.           VUBug.  Most of these have to do with the memory map.  Number
  324.           one is that hitting the reset button invokes the RAM test program
  325.           which CLEARS THE RAM!  For this reason, ctrl-C should be used to
  326.           recover control from a lost program.
  327.  
  328.                The memory map for the board looks like this:
  329.  
  330.                         0000 - 3FFF     System ROM
  331.                         4000 - 43FF     System RAM
  332.                         4400 - 7FFF     User RAM
  333.                         8000 - 803E     PI/T (68230) registers EVEN ONLY!
  334.                         A000            Load Port Status Register
  335.                         A002            Load Port Data Register
  336.                         C000            Terminal Port Status Register
  337.                         C002            Terminal Port Data Register
  338.  
  339.                Note that the PI/T and ACIA registers are on even only
  340.           locations.  Attempting to write to a peripheral chip on an odd
  341.           location will lock up the system.  Similarly, writing to system
  342.           RAM can cause unexpected results, up to and including locking
  343.           up the system.
  344.  
  345.           VII. Conclusion
  346.           
  347.                VUBug 4.0, mas68k, and the Raymatic development board form 
  348.           an effective development environment for M68000 assembly 
  349.           language programs.  While they cannot substitute for 
  350.           professional development/analysis systems, it is nevertheless 
  351.           possible to complete considerable software endeavors with a 
  352.           reasonable minimum of difficulty.
  353.            
  354.